// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

// import Panel from "./Panel";
import Panel from "./Panel";
import UiManager from "./UiManager";

const { ccclass, property, requireComponent } = cc._decorator;

@ccclass
export default class PanelAnimation extends cc.Component {
    private _data: any = null;
    get data(): any {
        return this._data;
    }
    set data(value: any) {
        this._data = value;
    }

    private _panel: Panel = null;

    protected onLoad(): void {
        this._panel = this.node.getComponent(Panel);
    }

    public playOpenAnimaiton() {
    }

    public playCloseAnimation() {
    }

    protected onOpenAnimationEnd() {
        UiManager.getInstance().emit(UiManager.EventType.OPEN_ANIMATION_END, this._panel);
    }
    
    protected onCloseAnimationEnd() {
        UiManager.getInstance().emit(UiManager.EventType.CLOSE_ANIMATION_END, this._panel);
    }
}
